cc.Class({
    extends: cc.Component,

    properties: {
        head: {
            type: cc.Sprite,
            default: null,
        },
        // 外号
        nickName: {
            type: cc.Label,
            default: null,
        },
        // 姓名
        heroName: {
            type: cc.Label,
            default: null,
        },
        // 血量
        blood: {
            type: cc.ProgressBar,
            default: null,
        },
        // 头像集
        avatarFrame: {
            type: [cc.SpriteFrame],
            default: [],
        },
    },

    // LIFE-CYCLE CALLBACKS:
    // 设置头像，外号， 姓名， 血量
    updateHeroCell(id, nickName, name, blood) {
        const avatar = this.avatarFrame[parseInt(id)];
        if (avatar) {
            this.head.spriteFrame = avatar;
            this.nickName.string = nickName;
            this.heroName.string = name;
            this.blood.progress = blood;
        }
    },
    // onLoad () {},
    //
    // start () {
    //
    // },

    // update (dt) {},
});
